<?php

class Mysql
{
    var $db_connector = null;
    var $insert_id = null;
    
    function num_rows($result)
    {
        return mysql_num_rows($result);
    }

    function Mysql($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_DATABASE)
    {
        if ($this->db_connector = mysql_connect($DB_HOST, $DB_USER, $DB_PASSWORD))
        {
            mysql_select_db($DB_DATABASE, $this->db_connector);
        }
    }

    function query($query)
    {
        $result = mysql_query($query) or die(mysql_error());
        //$this->num_rows = mysql_num_rows($result);
        $this->insert_id = mysql_insert_id($this->db_connector);
        return $result;
    }

    function close()
    {
        mysql_close($this->db_connector);
    }    
}
?>